home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / ACORNUSERS / EMULATOR / BABE / Documents / assembler next >
Text File  |  1998-02-06  |  5KB  |  71 lines

  1. Babe Assembler
  2. Project commenced: 13/1/98 
  3. By David Sharp
  4.  
  5. How to use the Assembler
  6. ========================
  7.  
  8. Drag your text file assembly program to the Babe icon on the icon bar, a save window should open with a Babe object code file (type &BAB) inside it. Drag this object code file to a filer window and the program will be assembled and saved. Read the emulator instructions for how to run the program.
  9.  
  10. If you want to know details about the program you are assembling, for example, why it may generate errors and stop, or any warnings that the assembler gives, then you will need to generate a logfile. To do this, go to the options window, and select 'generate assembler logfile' when you save the object code file, the assembler log is saved as the same filename suffixed with an 'L' and truncated in case the leafname is already 10 characters.
  11.  
  12. The entire system has been designed for compatibility with Andrew Molyneux's MM1 emulator for the PC (see note below). The files generated by my assembler are fully compatible with his emulator.
  13.  
  14. For details of the assembly language, background details, the programming competition and more, visit:
  15. http://www.geocites.com/SiliconValley/Park/4119/babe.htm
  16.  
  17. Notes to programmers
  18. ====================
  19.  
  20. The CI is always set to 0 at the start of the program, unless otherwise specified. It is also incremented at the start of every fetch-execute loop (ie. BEFORE each instruction is executed). Therefore as it is incremented from 0 before the 1st instruction also, the 1st line the computer executes is line 1, NOT line 0!
  21.  
  22. Your program MUST start at line 1, since otherwise any data stored there will be taken as a function, and will be executed as such. This could easily lead to incorrect results.
  23.  
  24. If you do not specify line 1, then this will be assembled as all 0s. The function 000 is JMP (jmp) and if the actline is 00 (line 0) it will set the CI to 0. On the next fetch execute cycle, the CI will be incremented to point to line 1 again, and thus setting up an infinite loop.
  25.  
  26. Compatibility:
  27. ==============
  28. There are only 2 other working emulators for the Baby that I know of, M1SIM by Andrew Molyneux (the official emulator) and MADM by Lee Wittenberg, both of which are for the PC.
  29.  
  30. I have kept compatibility with M1SIM, since this is the emulator used by the competition judges. All code generated by my assembler should work perfectly on the M1SIM emulator, as if it had been assembled using Andrew's assembler.
  31.  
  32. Important: If you use the instruction SB5 in your assembly code, my assembler will assemble it, Andrew's assembler will NOT!
  33.  
  34. Extra notes about this assembler:
  35. =================================
  36.  
  37. NUM is an assembler instruction to place a 32 bit signed integer on a specified store line. Note: the signing is done via twos complement.
  38.  
  39. The functions SUB and SB5 are identical to all extents and purposes, as they both go through the same routine on the emulator, but are included as separate functions on the assembler for the sake of versatility.
  40.  
  41. Each line of the assembly code can be terminated by either a CR or a LF or both.
  42.  
  43. Comments are denoted by a semi-colon (;) they may be at the start of a line (possibly after some leading spaces) or after an entire instruction. But NOT half way through an instruction!
  44.  
  45. Note, error lines reported by the assembler, relate to the text line in the assembly code when viewed in a text editor, not the line in the store! The ptr generated by the syntax checker points to the character on the error line that was being checked when the error was located (normally the source of the problem).
  46.  
  47. On the assembler, strictly speaking, if a CMP or a STP instruction is used then the actline will default to 0, as there is no line to act on with these instructions. However, for versatility if an actline is placed after a CMP or a STP then the assembler will generate a warning, but will still assemble the specified act line as well as the CMP or STP instruction.
  48.  
  49. Only decimal integers are accepted as parameters (at present), so any letter names will generate an error, with 2 exceptions. Any *text* placed after a CMP or a STP instruction will be ignored, since no actline is necessary, thus:
  50.       10 CMP test number
  51. is legal, whilst
  52.       10 SUB subtraction
  53. is not!
  54.  
  55. Contacting the Author
  56. =====================
  57. email:DavidSharp@ThePentagon.com
  58.  
  59. David Sharp
  60. 11 Woodlands Drive
  61. Grantham
  62. Lincs
  63. NG31 9DJ
  64.  
  65. I also maintain the Acorn Emulation page
  66. http://www.come.to/emulate
  67.  
  68.  
  69. Credits
  70. =======
  71. Thanks to Mohsen Alshayef, who pointed out 4 errors in 2 successive lines of code :o) (it was exam week)